Subject: Re: Boopsi, layers and clipping???
From: [email-masked] (Markus Juhani Aalto)
Date: 20 Mar 94 08:33:25 GMT
Newsgroups: comp.sys.amiga.programmer

In article <[email-masked]> [email-masked] (Patrik Lantto) writes:

> Hello!

> Here's a delicate problem for someone to solve!

> What's the proper way to do clipping when rendering a boopsi-gadget?

> I've tried the following:

> ...

>     struct GadgetInfo *ginfo = msg->gpr_GInfo;;
>     struct Region *old;

>     LockLayerInfo(ginfo->gi_Layer->LayerInfo);
>     LockLayer(NULL, ginfo->gi_Layer);

>     old = InstallClipRegion(ginfo->gi_Layer, myclipregion);

>     ... Rendering ...

>     InstallClipRegion(ginfo->gi_Layer, old);
>     UnlockLayer(ginfo->gi_Layer);
>     UnlockLayerInfo(ginfo->gi_Layer->LayerInfo);

> ...

> Rendering will be called whenever I change a prop-gadget, and
> it works just fine, but the problem comes when my window needs
> refreshing. The rendering routine will be called, it will render
> inside my clipregion, but as the routine returns, the clipregion
> is cleared, ie. nothing can be updated inside the window until it
> is moved or resized. I guess the problem is that I'm inside a pair
> of BeginUpdate() and EndUpdate(), but what to do about it?

You have propably guessed correctly as it can be a problem. You can get
around it however. First you check if it's window you are drawing
to (get window ptr from GadgetInfo). Check if the WINDOWREFRESHING
flag is up in Flags field and if it is then call EndUpdate(layer,FALSE)
and after you have made rendering call BeginUpdate(layer).

Note that you must call EndUpdate before you install new CLip region.

> Any help, suggestions or whatever will be appreciated.

I hope this helps. Oh and you can propably use BeginRefresh() and 
EndRefresh() too.

> - Patrik

> Patrik Lantto                            Email: [email-masked]
> Plojaregatan 26                          Phone:           +46 13 212225
> S-583 30  LINKOPING    Best comic: "Ha! Wild Zontars couldn't drag that
> Sweden                           information out of me! Do your worst!"

--

**************************************************************************
*         Markus Aalto              | Helsinki University of Technology  *
*                                   |                                    *
*  EMail: [email-masked]    | Faculty of Electric Engineering    *
*  Phone/Fax: 358-0-8746991         |                                    *
*                                   | Undergraduate in Computer Science  *
**************************************************************************